package com.ruoyi.web.controller.applet.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.common.collect.Maps;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;

@Controller
@RequestMapping("/applet/notice")
public class NoticeController {

	@Autowired
	private ISysNoticeService noticeService;

	@PostMapping("/getNoticeData")
	@ResponseBody
	public AjaxResult getNoticeData(String noticeType) {
		Map<String, Object> map = Maps.newConcurrentMap();
		SysNotice notice = new SysNotice();
		notice.setNoticeType(noticeType);
		notice.setStatus("0");
		List<SysNotice> list = noticeService.selectNoticeList(notice);
		map.put("noticeinfos", list);
		return AjaxResult.success("操作成功", map);
	}

	/**
	 * 根据id获取详情信息
	 * 
	 * @param noticeId
	 * @return
	 */
	@PostMapping("/getNoticeById")
	@ResponseBody
	public AjaxResult getNoticeById(Long noticeId) {
		Map<String, Object> map = Maps.newConcurrentMap();
		SysNotice noticeInfo = noticeService.selectNoticeById(noticeId);
		map.put("noticeInfo", noticeInfo);
		return AjaxResult.success("操作成功", map);
	}

}
